﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TrainSimulator.Model;
using TrainSimulator.Interfaces;

namespace TrainSimulator.State
{
    internal class TrainStopped : State
    {
        //private ITrain _train;

        public TrainStopped()
        {
            base._description = "Stopped";
        }

        public override IState Handle(ITrain train)
        {
            IState stateResult = null;
            if (train.Speed <= 0.2)
            {
                train.Speed = 0;
                stateResult = this;
            }
            else
            {
                stateResult = StateFactory.TrainBreaking;
            }
            return stateResult;
        }
    }
}
